﻿<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    StartupUri="ValidationRuleSetterWindow.xaml">
    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/WPFGlue;component/Validation/ValidationTemplate.xaml"/>
                <ResourceDictionary>
                    <ControlTemplate x:Key="ValidationTemplate">
                        <Border BorderBrush="Red" BorderThickness="1">
                            <Border.Visibility>
                                <Binding ElementName="placeholder" Path="AdornedElement.IsVisible">
                                    <Binding.Converter>
                                        <BooleanToVisibilityConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </Border.Visibility>
                            <Grid>
                                <AdornedElementPlaceholder x:Name="placeholder"/>
                                <Grid HorizontalAlignment="Right" VerticalAlignment="Stretch" 
                          Width="{Binding RelativeSource={RelativeSource Self}, Path=ActualHeight}"
                          Margin="3">
                                    <Ellipse Fill="Red" Stroke="White" Stretch="Uniform">
                                        <Ellipse.ToolTip>
                                            <ItemsControl ItemsSource="{Binding}" 
                                                          DisplayMemberPath="ErrorContent"/>
                                        </Ellipse.ToolTip>
                                    </Ellipse>
                                    <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" 
                                   Foreground="White" FontWeight="ExtraBold" 
                                   IsHitTestVisible="False">!</TextBlock>
                                </Grid>
                            </Grid>
                        </Border>
                    </ControlTemplate>
                </ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>
